Vue.component('myright',{
    props:["view_arr","like_arr"],
    template:`
    <div><!--自定义模板代码 必须有且只有一个根标签-->
     <!--浏览最多开始-->
            <ul class="list-group">
                <li class="list-group-item list-head">
                    <h4><i class="fa fa-eye"> 浏览最多</i></h4>
                </li>
                <li v-for="p in view_arr" class="list-group-item">
                    <!-- 左对齐 -->
                    <div class="media">
                        <div class="media-left">
                            <a :href="'/detail.html?id='+p.id">
                            <img :src="p.url" class="media-object"
                                 style="width:60px;height: 50px">
                            </a>
                        </div>
                        <div class="media-body">
                            <h4 class="media-heading">
                                <a :href="'/detail.html?id='+p.id">
                                    {{p.title}}</a>
                            </h4>
                            <p>{{p.intro}}</p>
                        </div>
                    </div>
                </li>
            </ul>
            <!--浏览最多结束-->

            <!--最受欢迎开始-->
            <ul class="list-group">
                <li class="list-group-item list-head">
                    <h4><i class="fa fa-thumbs-o-up"> 最受欢迎</i></h4>
                </li>

                <li class="list-group-item">
                    <!-- 左对齐 -->
                    <div v-for="p in like_arr" class="media">
                        <div class="media-left">
                            <a :href="'/detail.html?id='+p.id">
                            <img :src="p.url" class="media-object"
                                 style="width:60px;height: 50px">
                            </a>
                        </div>
                        <div class="media-body">
                            <h4 class="media-heading">
                                <a :href="'/detail.html?id='+p.id">
                                    {{p.title}}</a>
                            </h4>
                            <p>{{p.intro}}</p>
                        </div>
                    </div>
                </li>

            </ul>
            <!--浏览最多结束-->
    </div>
    `
})
let right_v=new Vue({
    el:"myright",
    data:{
        view_arr:[],
        like_arr:[]
    },
    created:function () {
        axios.get("/product/selectView").then(function (response) {
            right_v.view_arr=response.data;
        })
        axios.get("/product/selectLike").then(function (response) {
            right_v.like_arr=response.data;
        })
    }
})